<script setup lang="ts">
import { ref } from 'vue';

// 右侧导航数据
const navItems = ref([
  {
    id: 1,
    title: '科研项目',
    link: '/research/projects',
  },
  {
    id: 2,
    title: '科研机构',
    link: '/research/institutions',
  },
  {
    id: 3,
    title: '科研合作',
    link: '/research/cooperation',
  },
  {
    id: 4,
    title: '科研成果',
    link: '/research/achievements',
  },
]);

// 机构类型数据
const institutionTypes = ref([
  {
    id: 1,
    title: '政府批建机构',
    link: '#',
  },
  {
    id: 2,
    title: '自主设立机构',
    link: '#',
  },
  {
    id: 3,
    title: '联合共建机构',
    link: '#',
  },
]);

// 统计数据
const totalInstitutions = ref(440);
const statisticsDate = ref('2024年3月31日');
</script>

<template>
  <div class="page-layout">
    <div class="container">
      <!-- 说明文字区域 -->
      <div class="description-section">
        <p class="description-text">
          根据《清华大学科研机构管理规定》，清华大学科研机构根据其批准设立的主体不同，分为三类，包括政府批准机构、学校自主设立机构和学校与校外独立法人单位联合共建机构。
        </p>
        <p class="statistics-text">
          截至{{ statisticsDate }}，清华大学正在运行的校级科研机构共{{
            totalInstitutions
          }}个。
        </p>
      </div>

      <!-- 机构类型展示区域 -->
      <div class="institution-types">
        <div
          v-for="type in institutionTypes"
          :key="type.id"
          class="institution-type-card"
        >
          <h3>{{ type.title }}</h3>
          <div class="arrow-icon">→</div>
        </div>
      </div>
      <!-- 右侧导航栏 -->
      <div class="side-nav">
        <nav class="nav-menu">
          <a
            v-for="item in navItems"
            :key="item.id"
            :href="item.link"
            class="nav-item"
          >
            {{ item.title }}
          </a>
        </nav>
      </div>
    </div>
  </div>
</template>

<style scoped>
.page-layout {
  position: relative;
  display: flex;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  padding: 40px 20px;
  margin: 0 auto;
}

.description-section {
  margin-bottom: 40px;
  text-align: justify;
}

.description-text {
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--el-text-color-primary);
}

.statistics-text {
  font-size: 16px;
  color: var(--el-text-color-regular);
}

.institution-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.institution-type-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  cursor: pointer;
  background-color: var(--el-bg-color);
  border: 1px solid var(--el-border-color);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.institution-type-card:hover {
  box-shadow: 0 4px 12px rgb(0 0 0 / 10%);
  transform: translateY(-5px);
}

.institution-type-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
  color: var(--el-text-color-primary);
}

.arrow-icon {
  font-size: 24px;
  color: var(--el-text-color-secondary);
}

.side-nav {
  position: fixed;
  top: 50%;
  right: 20px;
  z-index: 100;
  width: 160px;
  padding: 15px;
  background-color: var(--el-bg-color);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 10%);
  transform: translateY(-50%);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-item {
  display: block;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--el-text-color-regular);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.nav-item:hover {
  color: var(--el-color-primary);
  background-color: var(--el-color-primary-light-9);
  transform: translateX(-4px);
}

@media (max-width: 768px) {
  .side-nav {
    display: none;
  }
}
</style>
